package com.solcoo.merchant.ui.pay;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.common.App;
import com.android.common.util.StringUtil;
import com.solcoo.merchant.R;
import com.solcoo.merchant.base.BaseActivity;

public class PaySuccessActivity extends BaseActivity {

	public static final String INTENT_KEK_TITLE = "title";
	public static final String INTENT_KEK_INFO = "resultInfo";
	public static final String INTENT_KEK_MSG = "resultMsg";
	public static final String INTENT_KEK_FAIL = "resultFail";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pay_success);
		setTitle(getIntent().getStringExtra(INTENT_KEK_TITLE));
		TextView info = (TextView) findViewById(R.id.result_info);
		ImageView icon = (ImageView) findViewById(R.id.result_icon);
		TextView msg = (TextView) findViewById(R.id.result_msg);

		final String resultMsg = getIntent().getStringExtra(INTENT_KEK_MSG);
		info.setText(getIntent().getStringExtra(INTENT_KEK_INFO));
		if (StringUtil.isNotBlank(resultMsg)) {
			icon.setImageResource(R.drawable.success);
			msg.setTextColor(App.getResources().getColor(R.color.pay_success));
			msg.setText(resultMsg);
		} else {
			icon.setImageResource(R.drawable.fail);
			msg.setTextColor(App.getResources().getColor(R.color.pay_fail));
			msg.setText(getIntent().getStringExtra(INTENT_KEK_FAIL));
		}
	}

}
